package com.crm.controller;

import com.crm.annotation.Log;
import com.crm.base.BusinessType;
import com.crm.base.OperatorType;
import com.crm.base.ResponseResult;
import com.crm.domain.vo.BusinessChangeVo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * @author Xanny
 */
@RestController
@RequestMapping("/index")
public class IndexController {
    @GetMapping
    @Log(title = "操作日志",businessType = BusinessType.OTHER,operatorType = OperatorType.MANAGE)
    public ResponseResult getAllData(){
        HashMap<String, Integer> data = new HashMap<>();
        data.put("cluesNum", 10);
        data.put("businessNum", 20);
        data.put("contractNum", 30);
        data.put("salesAmoun", 40);
        data.put("todayCluesNum", 10);
        data.put("todayBusinessNum", 10);
        data.put("todayContractNum", 10);
        data.put("todaySalesAmount", 40);
        data.put("todayTodayCluesNum", 10);
        data.put("todayTodayBusinessNum", 10);
        data.put("toallocatedCluesNum", 0);
        data.put("toallocatedBusinessNum", 0);
        return ResponseResult.success(data);
    }

    @GetMapping("/businessChangeStatistics")
    public ResponseResult businessChangeStatistics(){
        List<BusinessChangeVo> list = new ArrayList<>();
        BusinessChangeVo vo1 = BusinessChangeVo.builder().num(10).radio(86).deptName("研发部").createBy("admin").build();
        BusinessChangeVo vo2 = BusinessChangeVo.builder().num(11).radio(87).deptName("宣传部").createBy("admin").build();
        list.add(vo1);
        list.add(vo2);
        return ResponseResult.success(list);
    }

    @GetMapping("/salesStatistic")
    public ResponseResult salesStatistic(){
        List<BusinessChangeVo> list = new ArrayList<>();
        BusinessChangeVo vo1 = BusinessChangeVo.builder().num(10).radio(86).deptName("研发部").createBy("admin").build();
        BusinessChangeVo vo2 = BusinessChangeVo.builder().num(11).radio(87).deptName("宣传部").createBy("zhangsan").build();
        BusinessChangeVo vo3 = BusinessChangeVo.builder().num(11).radio(87).deptName("研发部").createBy("lisi").build();
        BusinessChangeVo vo4 = BusinessChangeVo.builder().num(11).radio(87).deptName("研发部").createBy("xanny").build();
        BusinessChangeVo vo5 = BusinessChangeVo.builder().num(11).radio(87).deptName("宣传部").createBy("hulonico").build();
        BusinessChangeVo vo6 = BusinessChangeVo.builder().num(11).radio(87).deptName("设计部").createBy("cc").build();
        BusinessChangeVo vo7 = BusinessChangeVo.builder().num(11).radio(87).deptName("传智教育").createBy("yujia").build();
        BusinessChangeVo vo8 = BusinessChangeVo.builder().num(11).radio(87).deptName("宣传部").createBy("xdd").build();
        list.add(vo1);
        list.add(vo2);
        list.add(vo3);
        list.add(vo4);
        list.add(vo5);
        list.add(vo6);
        list.add(vo7);
        list.add(vo8);
        return ResponseResult.success(list);
    }


}
